package com.garry;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Created by EchoGe on 2016/11/13.
 */
@Controller
@RequestMapping(value = "/test")
public class TestController {

    @Autowired
    private IUserService userService;

    @RequestMapping(value="/t",method = RequestMethod.GET)
    public String get(Model model){
        //User user = userService.get(0);
        User user=new User();
        user.setId(1);
        user.setTest("123");/*
        userService.insert(user);
        model.addAttribute("user",user);*/
        user=userService.get(1);
        model.addAttribute("text",user.getTest());
        return "index";
    }
}
